{% extends base %}

{% block head %}
<style type="text/css">
    /* 上传文件样式 */
    .progress {
        background-color: #f90;
        color: #fff;
        height: 20px;
        display: none;
        margin-left: 5px;
        border-width: 3px;
    }
    .progress span {
        display: block;
        background-color: #f90;
        color: #fff;
        height: 100%;
    }
    
    .finished-tag {
        color: #fff;
        background-color: green;
        border-width: 3px;
        border-radius: 3px;
        margin-left: 5px;
    }

    .option-td {
        width: 25%;
    }
</style>

{% set search_action = '/fs_upload/search' %}
{% set search_placeholder = '搜索文件' %}
{% init show_rename_file_link = False %}

{% include fs/component/css/fs_css.html %}

{% end %}

{% block body_left %}
    
    {% init page = "upload" %}

    <input type="hidden" id="dirname" value="{{dirname}}"/>

    <div class="card">
        <h3 class="card-title btn-line-height">
            <span>上传管理</span>
            <div class="float-right">
                {% if _is_admin %}
                    <a class="btn btn-default" href="{{_server_home}}/fs_list">文件管理</a>
                {% end %}
                <a class="btn btn-default" href="javascript:history.back();">返回</a>
            </div>
        </h3>
    </div>

    {% if page == "upload" %}
    <div class="card">
        日期
        <select name="year" value="{{year}}">
            {% for j in range(year-5,year+6) %}
                <option value="{{j}}">{{j}}</option>
            {% end %}
        </select>
        <select name="month" value="{{month}}">
            {% for i in range(1,13) %}
                <option value="{{i}}">{{i}}</option>
            {% end %}
        </select>

        <div class="float-right">
            <a href="{{upload_link_by_month(year, month, -1)}}" class="default-path-link">上个月</a>
            <a href="{{upload_link_by_month(year, month, 1)}}" class="default-path-link">下个月</a>
        </div>
    </div>
    {% end %}

    {% if page == "search" %}
    <div class="card">
        <h3>搜索结果</h3>
    </div>
    {% end %}

    {% import os %}
    <div class="card row">
        {% if page == "upload" %}
            {% include fs/mod_fs_upload.html %}
        {% end %}

        {% if len(pathlist) == 0 %}
            {% include common/text/empty_text.html %}
        {% end %}

        {% include fs/component/filelist_gallery.html %}
    </div>

    <script>
    $(function () {
        $("select").change(function (e) {
            var year = $("[name=year]").val();
            var month = $("[name=month]").val();
            location.href = "?year=" + year + "&month=" + month;
        });
    })
    </script>

{% end %}

{% block aside %}
    <div class="aside-item">
        <div class="aside-title">
            日期
        </div>
        <div class="aside-content">
        </div>
    </div>
{% end %}


{% block body_right %}
    {% include note/component/sidebar/group_manage_sidebar.html %}
{% end %}
